package com.smalls.redshoes.adapter;

import android.content.Context;
import android.text.TextUtils;

import com.smalls.newvideotwo.mvp.bean.LiveChannel;
import com.smalls.redshoes.R;

import cn.bingoogolapple.androidcommon.adapter.BGAAdapterViewAdapter;
import cn.bingoogolapple.androidcommon.adapter.BGAViewHolderHelper;

public class ChannelAdapter extends BGAAdapterViewAdapter<LiveChannel> {
    private int clickedPosition = -1;

    public ChannelAdapter(Context context) {
        super(context, R.layout.channel_item);
    }

    protected void fillData(BGAViewHolderHelper viewHolderHelper, int position, LiveChannel model) {
        viewHolderHelper.setText(R.id.tv_list_num, (position + 1) + "");
        if (!TextUtils.isEmpty(model.getTitle())) {
            viewHolderHelper.setText(R.id.tv_list_channelname, model.getTitle());
        }
    }

    public void setClickedPosition(int clickedPosition) {
        this.clickedPosition = clickedPosition;
        notifyDataSetChanged();
    }

    public int getClickedPosition() {
        return this.clickedPosition;
    }
}
